package com.douma._2022;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * 抖码算法，让算法学习变的简单有趣
 *
 * @作者 : 老汤
 */
public class 按身高和体重排队 {
    private static class Student {
        int id;
        int height;
        int weight;

        public Student(int id, int height, int weight) {
            this.id = id;
            this.height = height;
            this.weight = weight;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();

        Student[] students = new Student[n];
        String[] heights = sc.nextLine().split(" ");
        String[] weights = sc.nextLine().split(" ");

        for (int id = 0; id < n; id++) {
            int h = Integer.valueOf(heights[id]);
            int w = Integer.valueOf(weights[id]);
            // 编号 id 从 1 开始
            students[id] = new Student(id + 1, h, w);
        }

        Arrays.sort(students, new Comparator<Student>() {
            @Override
            public int compare(Student s1, Student s2) {
                if (s1.height != s2.height) {
                    // 先按身高升序排列
                    return s1.height - s2.height;
                } else if (s1.weight != s2.weight) {
                    // 身高相同，则按照体重升序排列
                    return s1.weight - s2.weight;
                }
                // 身高和体重都相同的话，按照 id 升序排列
                return s1.id - s2.id;
            }
        });

        // 打印结果
        for (int i = 0; i < n; i++) {
            if (i == n - 1) {
                System.out.println(students[i].id);
            } else {
                System.out.printf("%d ", students[i].id);
            }
        }

        sc.close();
    }
}
